package com.acme.bankapp.domain.bank;

/**
 * This class represents bank and allow you to add clients to the bank
 * 
 * @author Anton Kotov
 * 
 */
public class Bank {
	private Client[] clients;

	public Client[] getClients() {
		if (clients == null) {
			return null;
		}

		Client[] newClients = new Client[clients.length];
		System.arraycopy(clients, 0, newClients, 0, clients.length);
		return newClients;
	}

	public Bank addClient(Client client) {
		if (clients == null) {
			clients = new Client[1];
			clients[0] = client;
			return this;
		}

		Client[] newClients = new Client[clients.length + 1];
		System.arraycopy(clients, 0, newClients, 0, clients.length);
		newClients[clients.length] = client;
		clients = newClients;
		return this;
	}
}
